//
//  AliMNSRequest.h
//  AlibabaCloudMNSiOS
//
//  Created by David Chen on 28/03/2017.
//  Copyright © 2017 AliCloud. All rights reserved.
//
#import "AliMNSHttp.h"
#import "AliMNSQueueMeta.h"
#import "AliMNSClient.h"
#import "AliMNSSubscription.h"

@class AliMNSClient;

/*
 AliMNSRequestBase class
 */
@interface AliMNSRequestBase : NSObject

@property NSString* method;
@property NSString* requestId;

-(AliMNSHttpRequestInternal*) buildInternalHttpRequest:(AliMNSClient*) mnsClient;
-(void)buildUri:(AliMNSHttpRequestInternal*) reqInternal;

-(void)buildData:(AliMNSHttpRequestInternal*) reqInternal;

-(void)buildHeader:(AliMNSRequestBase*) req
   withInternalReq:(AliMNSHttpRequestInternal*) reqInternal
     withMNSClient:(AliMNSClient*) mnsClient;
@end


/*
 Interfaces for queue opertions request classes: CreateQueue, DeleteQueue, ListQueue,
 SendMessage, BatchSendMessage, PeekMessage, BatchPeekMessage, ReceiveMessage, 
 BatchReceiveMessage, ChangeMessageVisisbility.
 */

/*AliMNSCreateQueueRequest*/
@interface AliMNSCreateQueueRequest : AliMNSRequestBase
@property NSString* queueName;
@property NSInteger visibilityTimeout;
@property NSInteger maximumMessageSize;
@property NSInteger messageRetentionPeriod;
@property NSInteger delaySeconds;
@property NSInteger pollingWaitSeconds;
@property NSInteger loggingEnable;

-(id)initWithQueueName:(NSString*)queueName;
-(void) setPropertiesFromQueueMeta:(AliMNSQueueMeta*) qMeta;

@end

/*AliMNSDeleteQueueRequest*/
@interface AliMNSDeleteQueueRequest : AliMNSRequestBase

@property NSString* queueName;
-(id)initWithQueueName:(NSString*) queueName;

@end

/*AliMNSListQueueRequest*/
@interface  AliMNSListQueueRequest : AliMNSRequestBase

@property NSString* prefix;
@property NSInteger returnNumber;
@property NSString* marker;

-(id)initWithPrefix:(NSString*)prefix
   withReturnNumber:(NSInteger)returnNumber
         withMarker:(NSString*)marker;
@end

/*AliMNSSetQueueAttributesRequest*/
@interface AliMNSSetQueueAttributesRequest : AliMNSRequestBase

-(id)initWithQueueName:(NSString*)queueName;

@property NSString* queueName;
@property NSInteger visibilityTimeout;
@property NSInteger maximumMessageSize;
@property NSInteger messageRetentionPeriod;
@property NSInteger delaySeconds;

@end

/*AliMNSGetQueueAttributesRequest*/
@interface AliMNSGetQueueAttributesRequest : AliMNSRequestBase

-(id)initWithQueueName:(NSString*)queueName;
@property NSString* queueName;
@end

/*AliMNSSendMessageRequest*/
@interface AliMNSSendMessageRequest : AliMNSRequestBase

@property NSString* queueName;
@property NSString* messageBody;
@property NSInteger delaySeconds;
@property NSInteger priority;
@property BOOL base64Encode;

-(id) initWithQueueName:(NSString*)queueName
        withMessageBody:(NSString*)messageBody;
@end

/*AliMNSBatchSendMessageRequest*/
@interface AliMNSBatchSendMessageRequest : AliMNSRequestBase

@property NSString* queueName;
@property NSArray* messageList;
@property BOOL base64Encode;

-(id) initWithQueueName:(NSString*)queueName
        withMessageList:(NSArray*)messageList;
@end

/*AliMNSPeekMessageRequest*/
@interface AliMNSPeekMessageRequest : AliMNSRequestBase
@property NSString* queueName;
@property BOOL base64Encode;
-(id) initWithQueueName:(NSString*)queueName;
@end

/*AliMNSBatchPeekMessageRequest*/
@interface AliMNSBatchPeekMessageRequest : AliMNSRequestBase
@property NSString* queueName;
@property NSInteger numOfMessages;
@property BOOL base64Encode;

-(id) initWithQueueName:(NSString*)queueName
      withNumOfMessages:(NSInteger)numOfMessages;
@end

/*AliMNSReceiveMessageRequest*/
@interface AliMNSReceiveMessageRequest : AliMNSRequestBase

@property NSString* queueName;
@property NSInteger  waitSeconds;

-(id) initWithQueueName:(NSString*)queueName;

@end

/*AliMNSBatchReceiveMessageRequest*/
@interface AliMNSBatchReceiveMessageRequest : AliMNSRequestBase

@property NSString* queueName;
@property NSInteger numOfMessages;
@property NSInteger waitSeconds;

-(id) initWithQueueName:(NSString*)queueName
      withNumOfMessages:(NSInteger)numOfMessages;
@end

/*AliMNSDeleteMessageRequest*/
@interface AliMNSDeleteMessageRequest : AliMNSRequestBase

@property NSString* queueName;
@property NSString* receiptHandle;

-(id) initWithQueueName:(NSString*)queueName
      withReceiptHandle:(NSString*)receiptHandle;
@end

/*AliMNSBatchDeleteMessageRequest*/
@interface AliMNSBatchDeleteMessageRequest : AliMNSRequestBase
@property NSString* queueName;
@property NSArray* receiptHandleList;

-(id) initWithQueueName:(NSString*) qName
  withReceiptHandleList:(NSArray*) rHanldeList;
@end

/*AliMNSChangeMessageVisibilityRequest*/
@interface AliMNSChangeMessageVisibilityRequest : AliMNSRequestBase
@property NSString* queueName;
@property NSString* receiptHandle;
@property NSInteger visibilityTimeout;
-(id) initWithQueueName:(NSString*)queueName
      withReceiptHandle:(NSString*)receiptHandle
  withVisibilityTimeout:(NSInteger)visibilityTimeout;
@end


/*
 Interfaces for topic opertions request classes:CreateTopic, DeleteTopic, ListTopic,
 SetTopicAttributes, GetTopicAttributes, PublishMessage, Subcribe, Unsubscribe,
 ListSubscription, SetSubscriptionAttributes; GetSubscriptionAttributes;
 */

/*AliMNSCreateTopicRequest*/
@interface AliMNSCreateTopicRequest : AliMNSRequestBase
@property NSString* topicName;
@property NSInteger maximumMessageSize;
@property NSInteger loggingEnable;
-(id) initWithTopicName:(NSString*) pTopicName;
@end

/*AliMNSDeleteTopicRequest*/
@interface AliMNSDeleteTopicRequest: AliMNSRequestBase
@property NSString* topicName;

-(id) initWithTopicName:(NSString*) pTopicName;

@end

/*AliMNSListTopicRequest*/
@interface AliMNSListTopicRequest : AliMNSRequestBase
@property NSString* prefix;
@property NSInteger returnNumber;
@property NSString* marker;

-(id) initWithPrefix:(NSString*) pPrefix
    withReturnNumber:(NSInteger)pReturnNumber
          withMarker:(NSString *) pMarker;
@end

/*AliMNSSetTopicAttributesRequest*/
@interface AliMNSSetTopicAttributesRequest : AliMNSRequestBase
@property NSString* topicName;
@property NSInteger maximumMessageSize;
@property NSInteger loggingEnable;

-(id) initWithTopicName:(NSString*) pTopicName
        withMessageSize:(NSInteger) pMessageSize;
@end

/*AliMNSGetTopicAttributesRequest*/
@interface AliMNSGetTopicAttributesRequest : AliMNSRequestBase
@property NSString* topicName;

-(id) initWithTopicName:(NSString*) pTopicName;
@end

/*AliMNSPublishMessageRequest*/
@interface AliMNSPublishMessageRequest : AliMNSRequestBase
@property NSString* topicName;
@property NSString* messageBody;
@property NSString* messageTag;
@property NSString* directMail;
@property NSString* directSMS;

-(id) initWithTopicName:(NSString*) pTopicName
        withMessageBody:(NSString*) pMessageBody
         withMessageTag:(NSString*) pMessageTag;

@end

/*AliMNSSubscribeRequest*/
@interface AliMNSSubscribeRequest : AliMNSRequestBase
@property NSString* topicName;
@property NSString* subscriptionName;
@property NSString* endpointName;
@property NSString* filterTag;
@property NotifyStrategy notifyStrategy;
@property NotifyContentFormat notifyContentFormat;

-(id) initWithTopicName:(NSString*) pTopicName
   withSubscriptionName:(NSString*) pSubcriptionName
           withEndpoint:(NSString*) pEndpoint;
@end

/*AliMNSUnsubcribeRequest*/
@interface AliMNSUnsubcribeRequest : AliMNSRequestBase
@property NSString* topicName;
@property NSString* subscriptionName;

-(id) initWithTopicName:(NSString*) pTopicName
   withSubscriptionName:(NSString *)pSubcriptionName;

@end

/*AliMNSListSubscriptionRequest*/
@interface AliMNSListSubscriptionRequest : AliMNSRequestBase
@property NSString* topicName;
@property NSString* prefix;
@property NSInteger returnNumber;
@property NSString* marker;

-(id) initWithTopicName:(NSString*) pTopicName;

@end

/*AliMNSSetSubscriptionAttributesRequest*/
@interface AliMNSSetSubscriptionAttributesRequest : AliMNSRequestBase
@property NSString* topicName;
@property NSString* subscriptionName;
@property NotifyStrategy notifyStrategy;

-(id) initWithTopicName:(NSString*) pTopicName
   withSubscriptionName:(NSString *)pSubcriptionName;

@end

/*AliMNSSetSubscriptionAttributesRequest*/
@interface AliMNSGetSubscriptionAttributesRequest : AliMNSRequestBase
@property NSString* topicName;
@property NSString* subscriptionName;

-(id) initWithTopicName:(NSString*) pTopicName
   withSubscriptionName:(NSString *)pSubcriptionName;
@end
